package com.zyh.demo;

import java.util.Scanner;

public class OperatorDemo1 {
    public static void main(String[] args) {
//        获取两个数的最大值
        Scanner input = new Scanner(System.in);
//        提示并接收
        System.out.println("请输入第一个数");
        double num1 = input.nextDouble();
        System.out.println("请输入第二个数");
        double num2 = input.nextDouble();
//        判断最大值并把结果赋值给result
        String result1 = num1 > num2 ? "max:" + num1 : "max:" + num2;
        System.out.println("result = " + result1);
        System.out.println("--------------------------------");
//        获取两个数的最小值
        System.out.println("请输入第一个数");
        double num3 = input.nextDouble();
        System.out.println("请输入第二个数");
        double num4 = input.nextDouble();
//        判断最大值并把结果赋值给result
        String result2 = num3 < num4 ? "min:" + num3 : "min:" + num4;
        System.out.println("result2 = " + result2);
        System.out.println("--------------------------------");
//        获取三个数的最大值
        System.out.println("请输入第一个数");
        double num5 = input.nextDouble();
        System.out.println("请输入第二个数");
        double num6 = input.nextDouble();
        System.out.println("请输入第三个数");
        double num7 = input.nextDouble();
        double temp = num5 > num6 ? num5 : +num6;
        double max = temp > num7 ? temp : num7;
        System.out.println("max:" + max);


    }
}
